package com.hh.subClass.mapper;

import com.hh.subClass.vo.SubClassImport;
import com.hh.subClass.vo.SubClassVo;
import com.hh.subClass.bean.SpareChild;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SpareChildMapper {
    /**
     * 判断Code和Name是否重复
     * @param spareCode
     * @return
     */
    SpareChild judgeCodeExist(String spareCode);

    SpareChild judgeNameExist(String spareName);
    /**
     *
     * @param id
     * @return
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * 插入
     * @param record
     * @return
     */
    int insert(SpareChild record);

    /**
     * 分页和条件查询
     * @param subClassVo
     * @return
     */
    List<SpareChild> selectAllByPage(SubClassVo subClassVo);


    SpareChild selectByPrimaryKey(Integer id);

    /**
     * 更新信息
     * @param spareChild
     * @return
     */
    int updateByPrimaryKey(SpareChild spareChild);

    /**
     * 更新状态
     * @param id
     * @param status
     * @return
     */
    int updateStatusByPrimaryKey(Integer id,Integer status);

    /**
     * 根据id判断和当前条的数据没有重复的spareName
     * @param id
     * @param spareName
     * @return
     */
    SpareChild judgeUpdateName(Integer id, String spareName);

    Integer judgeUpdateStatus(Integer id,Integer status);

    List<SpareChild> selectAllAsList();

    List<SubClassImport> getAllSubclass();

    void insertFromFile(List<SubClassImport> subClassVoList);
}